
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sale Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style type="text/css" media="print">
.hide{display:none}
</style>
<script type="text/javascript">
function printpage() {
document.getElementById('printButton').style.visibility="hidden";
window.print();
document.getElementById('printButton').style.visibility="visible";  
}
</script>
<body style="font-size:13px;">
<?php
include('function/connection.php'); 
if(isset($_GET['avail']) !='')
{
?>
<input name="print" type="button" value="Print" id="printButton" onClick="printpage()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center">
      <table width="595" border="0" cellspacing="0" cellpadding="0">
       
        <tr>
          <td height="30" align="left"><h3><img src="images/logo_marly.png" width="130"  height="40" />&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;Available Report</h3></td>
          <td width="35%"><strong>Hay Soeung Company</strong><br />
Russian Blvd Sang Kat Toek Thla, <br />Khan Sen Sok, Phnom Penh, Cambodia<br />
Email: hay_soeng@yahoo.com<br/>
Website:&nbsp;www.haysoeungautomobile.com<br />
Tel: <span large;\>+85512 544498</span><br />&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;+85512 287899<br/>
			
		  </td>
        </tr>
        <tr>
          <td height="30" align="center" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td align="left" colspan="2">
          		<b style="color:#00F; font-size:13px;">Closing Date:&nbsp;&nbsp;&nbsp;  <?php echo date('Y-m-d',time());?></b>
          </td>
        </tr>
        <tr>
          <td width="45" colspan="2"><hr></td>
        </tr>
        <tr>
          <td colspan="2"> <table width="100%"  border="0" cellspacing="0" cellpadding="0">
			  <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
			<?php  
			  	$sql="SELECT sa.*,c.cat_name FROM tbl_stocks_available sa  INNER JOIN tbl_category  c
					 ON sa.cat_id=c.cat_id ORDER BY c.cat_id DESC ";
				$result=mysql_query($sql);
				$j=1;
				$category="";
				while ($line = mysql_fetch_object($result)) {
			?>
            	<tr>
                	<td colspan="5" align="left">
            <?php
					if($category!= $line->cat_name) {
                                echo "<b style='color:red;'>Category&nbsp;:&nbsp;&nbsp;".$line->cat_name;  
                                $category = $line->cat_name;
								echo "<br><br>";
					
            ?>
            			<tr>
                            <td><strong>No</strong></td>
                            <td><strong>Product Code</strong></td>
                            <td><strong>Product Name</strong></td>
                            <td><strong>Quality</strong></td>
                        </tr>
                        <tr> 
              				<td colspan="6"><hr></td>
              			</tr>
            <?php
					}
						
            ?>    
               		</td>
               </tr>       
						
				<tr height="25">
                <td><?php echo "00".$j; ?></td>
                <td><?php echo $line->pd_code; ?></td>
                <td><?php echo $line->pd_name; ?></td>
                <td align="center"><?php echo $line->qty; ?></td>
              </tr>  	
			<?php
				$j++;
			}
			 ?>
          </table></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
<?php
}
else{
	echo "Please from and to date to process report";
}
?>
</body>
</html>
